<?php
/**
 * Created by PhpStorm.
 * User: Cloud
 * Date: 2018/3/28
 * Time: 10:57
 */

?>
<!DOCTYPE html>
<html>
<head>
    <!--[if lt IE 7]>
    <div class="ie6_error">还在用<strong>漏洞百出的IE6浏览器</strong>么？为了您的网络安全，请升级浏览器 <a target="_blank"
                                                                               href="http://browsehappy.com">立即升级</a>
    </div>
    <![endif]-->
    <meta charset="utf-8">
    <title>个人中心（user-manager）-文具1号</title>
    <meta name="description"
          content="文具1号作为上海办公用品供货商公司,专为世界500强企业及SOHO办公族提供网上商城一站式办公耗材批发及采购服务,一站式选购办公日用文具用品,厂家直销,好货又便宜【阳光采购就上文具1号 阳光价格 老板放心 品质保障 员工省力】"/>
    <meta name="keywords" content="办公用品,办公文具,办公文具网站,文具网站,办公用品网,文具采购网,金万年"/>
    <meta name="copyright" content="上海易推信息科技有限公司"/>
    <meta name="renderer" content="webkit">
    <base href="<?php echo base_url(); ?>"/>
    <link rel="shortcut icon" href="favicon.ico"/>
    <link rel="stylesheet" href="public/js/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="public/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/cost-center.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/popup.css"/>
    <!--[if lte IE 9]>
    <script type="text/javascript" src="public/js/html5shiv-printshiv-3.js"></script>
    <![endif]-->
</head>
<body>
<div class="bg">
    <!--common - head -->
    <?php $this->load->view('common/header.php'); ?>
    <!--common - head end-->

    <div class="container mt30">
        <div class="my-center-container">
            <?php $this->load->view('member/personal_left.php'); ?>


            <div class="my-center-right">
                <p class="my-center-right-tit">基本资料</p>
                <div class="my-center-right-cont">
                    <div class="head-icon-box">
                        <!--<img class="head-icon" src="public/images/img_avatar_manager.png" alt="">-->
                        <img class="head-icon" src="public/images/img_avatar_admin.png" alt="">
                        <!--<img class="head-icon" src="public/images/img_avatar_user.png" alt="">-->
                    </div>
                    <div class="my-center-right-form-box">
                        <?php if (isset($data)): ?>
                            <form class="layui-form  my-center-right-form workbench-detail-form" method="post"
                                  action="">

                                <div class="layui-form-item">
                                    <label class="layui-form-label">您的姓名：</label>

                                    <div class="layui-input-block">
                                        <label class="layui-form-label" style="width:auto;"
                                               id="name_label"><?php echo $data['name'] ?></label>
                                        <input style="display: none;" id="name_input" type="text" name="name"
                                               lay-verify="name" autocomplete="off" placeholder="请输入您的姓名"
                                               value="<?php echo $data['name'] ?>" class="layui-input">
                                        <a href="javascript:void(0);"
                                           onclick="$('#name_label').css('display','none');$('#name_input').css('display','block');$(this).css('display','none');$('#name_save').css('display','block');"><span
                                                    class="bind">修改</span></a>
                                        <a href="javascript:void(0);" style="display: none;" id="name_save"><span
                                                    class="bind " id="<?php echo $data['id'] ?>">保存</span></a>
                                    </div>
                                </div>
                                <!--您的姓名-->

                                <div class="layui-form-item">
                                    <label class="layui-form-label">角 色：</label>
                                    <div class="layui-input-block">
                                        <label class="layui-form-label">主账户</label>
                                        <!--                                    <input type="text" name="user" required placeholder="请输入您的角色" style="width:230px;" value="user" autocomplete="off" class=" layui-input">-->
                                    </div>
                                </div><!--您的姓名-->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">所属公司：</label>
                                    <div class="layui-input-block">
                                        <label class="layui-form-label" style="width:auto;"
                                               id="company_label"><?php echo $data['company'] ?></label>
                                        <input style="display: none;" id="company_input" type="text" name="company"
                                               lay-verify="company" autocomplete="off" placeholder="请输入所属公司"
                                               value="<?php echo $data['company'] ?>" class="layui-input">
                                        <a href="javascript:void(0);"
                                           onclick="$('#company_label').css('display','none');$('#company_input').css('display','block');$(this).css('display','none');$('#company_save').css('display','block');"><span
                                                    class="bind">修改</span></a>
                                        <a href="javascript:void(0);" style="display: none;" id="company_save"><span
                                                    class="bind" id="<?php echo $data['id'] ?>">保存</span></a>
                                    </div>
                                </div><!--所属公司-->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">电子邮箱：</label>
                                    <div class="layui-input-block">
                                        <?php
                                        if ($data['email']) {
                                            ?>
                                            <label class="layui-form-label" style="width:auto;"
                                                   id="email_label"><?php echo $data['email'] ?></label>

                                            <!--                                            <a href="javascript:void(0);"-->
                                            <!--                                               onclick="$('#email_label').css('display','none');$('#email_input').css('display','block');$(this).css('display','none');$('#email_save').css('display','block');"-->
                                            <!--                                               id="email_new"><span class="bind">修改</span></a>-->
                                            <a href="javascript:void(0);" style="" id="email_save"><span
                                                        class="bind" id="<?php echo $data['id'] ?>">修改</span></a>
                                            <?php
                                        } else {
                                            ?>
                                            <!--                                            <a href="javascript:void(0);"-->
                                            <!--                                               onclick="$('#email_input').css('display','block');$(this).css('display','none');$('#email_save').css('display','block');"-->
                                            <!--                                               id="email_new"><span class="bind">绑定</span></a>-->
                                            <a href="javascript:void(0);" style="" id="email_save_new"><span
                                                        class="bind" id="<?php echo $data['id'] ?>">绑定</span></a>
                                            <?php
                                        }
                                        ?>
                                        <input id="email_input" type="email" style="display: none;" id="email"
                                               name="email" lay-verify="phone" autocomplete="off" placeholder="请输入电子邮箱"
                                               value="<?php echo $data['email'] ?>" data="<?php echo $data['email'] ?>"
                                               class="layui-input">
                                        <a href="javascript:void(0);" style="display: none;" id="email_save"><span
                                                    class="bind" id="<?php echo $data['id'] ?>">保存</span></a>

                                    </div>
                                </div>
                                <!--电子邮箱-->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">联系方式：</label>
                                    <div class="layui-input-block">
                                        <?php
                                        if ($data['tel']) {
                                            ?>
                                            <label class="layui-form-label" style="width:auto;"
                                                   id="tel_label"><?php echo $data['tel'] ?></label>
                                            <!--                                            <a href="javascript:void(0);"-->
                                            <!--                                               onclick="$('#tel_label').css('display','none');$('#tel_input').css('display','block');$(this).css('display','none');$('#tel_save').css('display','block');"-->
                                            <!--                                               id="tel_new"><span class="bind">修改</span></a>-->
                                            <a href="javascript:void(0);" style="" id="tel_save"><span
                                                        class="bind" id="<?php echo $data['id'] ?>">修改</span></a>
                                            <?php
                                        } else {
                                            ?>
                                            <!--                                            <a href="javascript:void(0);"-->
                                            <!--                                               onclick="$('#tel_input').css('display','block');$(this).css('display','none');$('#tel_save').css('display','block');"-->
                                            <!--                                               id="tel_new"><span class="bind">绑定</span></a>-->
                                            <a href="javascript:void(0);" style="" id="tel_save_new"><span
                                                        class="bind" id="<?php echo $data['id'] ?>">绑定</span></a>
                                            <?php
                                        }
                                        ?>
                                        <input id="tel_input" type="tel" style="display: none;" id="tel" name="tel"
                                               lay-verify="phone" autocomplete="off" placeholder="请输入联系方式"
                                               value="<?php echo $data['tel'] ?>" data="<?php echo $data['tel'] ?>"
                                               class="layui-input">
                                        <a href="javascript:void(0);" style="display: none;" id="tel_save"><span
                                                    class="bind" id="<?php echo $data['id'] ?>">保存</span></a>

                                    </div>
                                </div>
                                <!--联系方式-->
                                <!--                            <div class="btn-box1">-->
                                <!--                                <a  href="javascript:;"  id="5555"   class="btn-cancel">保存</a>-->
                                <!--                                <a href="javascript:;" class="btn-submit">重置</a>-->
                                <!--                            </div>-->

                            </form>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php $this->load->view('common/bottom.php'); ?>
</div>

<!--邮箱验证-->
<div class="pop layui-layer  layui-layer-page pop-email-change" id="layui-layer2" type="page" times="2" showtime="0"
     contype="object" style="z-index: 12; width: 420px; height: auto; z-index: 12; width: 420px; height: auto;  top: 50%;
 left: 50%;
 margin-left:-210px;
 margin-top:-150px; display: none; display: none;">
    <div class="layui-layer-title mb20" style="">
        <div class="popup_title login_hd mb20" move="ok" style="cursor: move;">
            <img class="login_close" src="public/images/btn_close2.png" onmousedown="hidePop(event)">
        </div>
    </div>
    <div class="layui-layer-content">
        <div class="popup_content_mail_check dn layui-layer-wrap" style="display: block;">
            <form action="" method="post" class="zForm w375 pb26">
                <span class="login_tig mb8">验证身份</span>
                <div class="login_border mb22 w375">
                    <div class="login_border_left w250"></div>
                    <div class="login_border_right w125"></div>
                </div>

                <input type="hidden" id="mtep1" value="check">
                <input type="hidden" id="mailone" value="whityyi@supergk.com">

                <div id="oldmail" class="vvvv">
                    <div class="ovh">
                        <label class="red2 fl mr5 special25 lh35">*</label>
                        <label class="w88 h35 sf tar mr16 fl">验证方式:</label>
                        <label class="secrity_color sf lh35">
                            <input type="radio" class="hidden-input" name="RadioGroup2" id="RadioGroup2_0"
                                   value="E-mail验证" checked="checked">
                            <span class="your style about checkbox"></span> E-mail验证
                        </label>
                    </div>
                    <div class="sf ovh h35 mb13">
                        <span class="red2 fl mr5 special25">*</span>
                        <span class="fl w88 mr16 tar">原E-mail:</span>
                        <span class="mr10 fl six"><?php echo $data['email'] ?></span>
                    </div>
                    <div class=" mb13 w375 ovh sendEmail" id="">
                        <label class="red2 fl mr5 special43">*</label>
                        <label class="fl sf w88 mr16 tar s-code" id="">校验码:</label>
                        <input type="text" class="checkcode_txt td2 mr8 w125" id="emailCode" placeholder="请输入6位校验码"
                               maxlength="6">
                        <span class="fl w120 h35 freeCode_bg tac curp red"><input type="button" class="code_lock"
                                                                                  onclick="sendEma(this,1)"
                                                                                  id="sendEmail"
                                                                                  value="发送校验码"></span>
                    </div>
                </div>

                <div id="newmail" style="display: none" class="wwwww">
                    <p class="sf red pl62 mb15">身份验证成功，请继续进行修改操作</p>

                    <div class=" mb13 w375 ovh">
                        <label class="red2 fl mr5 special25">*</label>
                        <label class="fl sf w88 mr16 tar">新E-mail:</label>
                        <input class="checkcode_txt td2 mr8 w216" type="text" id="mailtwo" maxlength="100">
                    </div>
                    <div class=" mb13 w375 ovh sendEmail" id="">
                        <label class="red2 fl mr5 special43">*</label>
                        <label class="fl sf w88 mr16 tar s-code" id="">校验码:</label>
                        <input type="text" class="checkcode_txt td2 mr8 w125" id="emailCode1" placeholder="请输入6位校验码"
                               maxlength="6">
                        <span class="fl w120 h35 freeCode_bg tac curp red"><input type="button" class="code_lock"
                                                                                  onclick="sendEma(this,2)"
                                                                                  id="sendEmail"
                                                                                  value="发送校验码"></span>
                    </div>
                </div>

                <!--                <div class="checkcode mb44 w375">-->
                <!--                    <label class="red2 fl mr5 special43">*</label>-->
                <!--                    <label class=" sf w88 mr16 tar fl">验证码:</label>-->
                <!--                    <input type="text" class="iTextWidth89 checkcode_txt mr4" id="emailCaptcha" maxlength="4">-->
                <!--                    <div class="checkcode_pic mr8">-->
                <!--                        <img id="J_checkcode_mail" src="index.php?app=mall/MDefault&amp;act=regVerification&amp;t=1522113034733" width="90" height="30">-->
                <!--                    </div>-->
                <!--                    <span class="r40 fl curp" onclick="changeCaptcha('mail')">看不清换一张</span>-->
                <!--                </div>-->
                <input type="hidden" id="mtep2" value="">
                <div class="ovh w224 center">
                    <div class="fl mr19">
                        <input type="button" class="iSubmit w102 h34 sEnter" value="" data="1" id="emailCheck">
                    </div>
                    <div class="fl">
                        <input type="button" class="iSubmit w102 h34 sChannel" onclick="hidePop()" value="">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <a class="layui-layer-ico layui-layer-close layui-layer-close1" href="javascript:;"></a>
</div>

<!--邮箱验证-->
<div class="pop layui-layer  layui-layer-page pop-email-change" id="layui-layer3" type="page" times="2" showtime="0"
     contype="object" style="z-index: 12; width: 420px; height: auto; z-index: 12; width: 420px; height: auto;  top: 50%;
 left: 50%;
 margin-left:-210px;
 margin-top:-150px; display: none; display: none;">
    <div class="layui-layer-title mb20" style="">
        <div class="popup_title login_hd mb20" move="ok" style="cursor: move;">
            <img class="login_close" src="public/images/btn_close2.png" onmousedown="hidePop(event)">
        </div>
    </div>
    <div class="layui-layer-content">
        <div class="popup_content_mail_check dn layui-layer-wrap" style="display: block;">
            <form action="" method="post" class="zForm w375 pb26">

                <input type="hidden" id="mtep1" value="check">
                <input type="hidden" id="mailone" value="whityyi@supergk.com">

                <div id="oldmail" class="vvvv">
                    <div class=" mb13 w375 ovh">
                        <label class="red2 fl mr5 special25">*</label>
                        <label class="fl sf w88 mr16 tar">新E-mail:</label>
                        <input class="checkcode_txt td2 mr8 w216" type="text" id="mailtwo_new" maxlength="100">
                    </div>
                    <div class=" mb13 w375 ovh sendEmail" id="">
                        <label class="red2 fl mr5 special43">*</label>
                        <label class="fl sf w88 mr16 tar s-code" id="">校验码:</label>
                        <input type="text" class="checkcode_txt td2 mr8 w125" id="emailCode_new" placeholder="请输入6位校验码"
                               maxlength="6">
                        <span class="fl w120 h35 freeCode_bg tac curp red"><input type="button" class="code_lock"
                                                                                  onclick="sendEma(this,3)"
                                                                                  id="sendEmail"
                                                                                  value="发送校验码"></span>
                    </div>
                </div>


                <input type="hidden" id="mtep2" value="">
                <div class="ovh w224 center">
                    <div class="fl mr19">
                        <input type="button" class="iSubmit w102 h34 sEnter" value="" id="emailCheck_new"
                               class=".emailCheck">
                    </div>
                    <div class="fl">
                        <input type="button" class="iSubmit w102 h34 sChannel" onclick="hidePop()" value="">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <a class="layui-layer-ico layui-layer-close layui-layer-close1" href="javascript:;"></a>
</div>


<!--手机验证-->
<div class="pop layui-layer  layui-layer-page pop-email-change" id="layui-layer1" type="page" times="2" showtime="0"
     contype="object" style="z-index: 12; width: 420px; height: auto;  top: 50%;
 left: 50%;
 margin-left:-210px;
 margin-top:-150px; display: none;">
    <div class="layui-layer-title mb20" style="">
        <div class="popup_title login_hd mb20" move="ok" style="cursor: move;">
            <img class="login_close" src="public/images/btn_close2.png" onmousedown="hidePop(event)">
        </div>
    </div>
    <div class="layui-layer-content">
        <div class="popup_content_mail_check dn layui-layer-wrap" style="display: block;">
            <form action="" method="post" class="zForm w375 pb26">
                <span class="login_tig mb8">验证身份</span>
                <div class="login_border mb22 w375">
                    <div class="login_border_left w250"></div>
                    <div class="login_border_right w125"></div>
                </div>

                <input type="hidden" id="mtep1" value="check">
                <input type="hidden" id="mailone" value="whityyi@supergk.com">

                <div id="oldmail" class="vvvv1">
                    <div class="ovh ">
                        <label class="red2 fl mr5 special25 lh35">*</label>
                        <label class="w88 h35 sf tar mr16 fl">验证方式:</label>
                        <label class="secrity_color sf lh35">
                            <input type="radio" class="hidden-input" name="RadioGroup2" id="RadioGroup2_0"
                                   value="E-mail验证" checked="checked">
                            <span class="your style about checkbox"></span> 手机验证
                        </label>
                    </div>
                    <div class="sf ovh h35 mb13">
                        <span class="red2 fl mr5 special25">*</span>
                        <span class="fl w88 mr16 tar">原手机号:</span>
                        <span class="mr10 fl six"><?php echo $data['tel'] ?></span>
                    </div>
                </div>
                <div class=" mb13 w375 ovh vvvv1">
                    <label class="red2 fl mr5 special43">*</label>
                    <label class="fl sf w88 mr16 tar s-code">校验码:</label>
                    <input type="text" class="checkcode_txt td2 mr8 w125" id="telCode" placeholder="请输入6位校验码"
                           maxlength="6">
                    <span class="fl w120 h35 freeCode_bg tac curp red"><input type="button" class="code_lock"
                                                                              onclick="sendCode(this,1)" id="sendTel"
                                                                              value="发送校验码"></span>
                </div>

                <div id="newmail" class="wwwww1" style="display: none">
                    <p class="sf red pl62 mb15">身份验证成功，请继续进行修改操作</p>

                    <div class=" mb13 w375 ovh">
                        <label class="red2 fl mr5 special25">*</label>
                        <label class="fl sf w88 mr16 tar">新手机号:</label>
                        <input class="checkcode_txt td2 mr8 w216" type="text" id="teltwo" maxlength="100" value="">
                    </div>
                </div>
                <div class=" mb13 w375 ovh wwwww1" style="display: none">
                    <label class="red2 fl mr5 special43">*</label>
                    <label class="fl sf w88 mr16 tar s-code">校验码:</label>
                    <input type="text" class="checkcode_txt td2 mr8 w125" id="telCode1" placeholder="请输入6位校验码"
                           maxlength="6">
                    <span class="fl w120 h35 freeCode_bg tac curp red"><input type="button" class="code_lock"
                                                                              onclick="sendCode(this,2)" id="sendTel"
                                                                              value="发送校验码"></span>
                </div>
                <!--                <div class="checkcode mb44 w375">-->
                <!--                    <label class="red2 fl mr5 special43">*</label>-->
                <!--                    <label class=" sf w88 mr16 tar fl">验证码:</label>-->
                <!--                    <input type="text" class="iTextWidth89 checkcode_txt mr4" id="emailCaptcha" maxlength="4">-->
                <!--                    <div class="checkcode_pic mr8">-->
                <!--                        <img id="J_checkcode_mail" src="index.php?app=mall/MDefault&amp;act=regVerification&amp;t=1522113034733" width="90" height="30">-->
                <!--                    </div>-->
                <!--                    <span class="r40 fl curp" onclick="changeCaptcha('tel')">看不清换一张</span>-->
                <!--                </div>-->
                <input type="hidden" id="mtep2" value="">
                <div class="ovh w224 center">
                    <div class="fl mr19">
                        <input type="button" class="iSubmit w102 h34 sEnter" value="" id="telCheck" data="1"
                        >
                    </div>
                    <div class="fl">
                        <input type="button" class="iSubmit w102 h34 sChannel" onclick="hidePop()" value="">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <a class="layui-layer-ico layui-layer-close layui-layer-close1" href="javascript:;"></a></div>


<div class="pop layui-layer  layui-layer-page pop-email-change" id="layui-layer4" type="page" times="2" showtime="0"
     contype="object" style="z-index: 12; width: 420px; height: auto;  top: 50%;
left: 50%;
margin-left:-210px;
margin-top:-150px; display: none;">
    <div class="layui-layer-title mb20" style="">
        <div class="popup_title login_hd mb20" move="ok" style="cursor: move;">
            <img class="login_close" src="public/images/btn_close2.png" onmousedown="hidePop(event)">
        </div>
    </div>
    <div class="layui-layer-content">
        <div class="popup_content_mail_check dn layui-layer-wrap" style="display: block;">
            <form action="" method="post" class="zForm w375 pb26">
                <div class=" mb13 w375 ovh">
                    <label class="red2 fl mr5 special25">*</label>
                    <label class="fl sf w88 mr16 tar">新手机号:</label>
                    <input class="checkcode_txt td2 mr8 w216" type="text" id="teltwo_new" maxlength="100" value="">
                </div>
                <div class=" mb13 w375 ovh vvvv1">
                    <label class="red2 fl mr5 special43">*</label>
                    <label class="fl sf w88 mr16 tar s-code">校验码:</label>
                    <input type="text" class="checkcode_txt td2 mr8 w125" id="telCode_new" placeholder="请输入6位校验码"
                           maxlength="6">
                    <span class="fl w120 h35 freeCode_bg tac curp red"><input type="button" class="code_lock"
                                                                              onclick="sendCode(this,3)" id="sendTel"
                                                                              value="发送校验码"></span>
                </div>


                <input type="hidden" id="mtep2" value="">
                <div class="ovh w224 center">
                    <div class="fl mr19">
                        <input type="button" class="iSubmit w102 h34 sEnter" value="" id="telCheck_new"
                        >
                    </div>
                    <div class="fl">
                        <input type="button" class="iSubmit w102 h34 sChannel" onclick="hidePop()" value="">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <a class="layui-layer-ico layui-layer-close layui-layer-close1" href="javascript:;"></a></div>


<div class="mask none"></div>

<script type="text/javascript" src="public/js/jquery.min.js"></script>
<script src="public/js/layui/layui.js"></script>
<script type="text/javascript" src="public/js/index.js"></script>
<script type="text/javascript" src="public/js/owl.carousel.min.js"></script>

<script>
    layui.use(['element', 'form', 'layedit', 'laydate', 'upload'], function () {
        var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit;
        var $ = layui.jquery
            , upload = layui.upload;

        //监听导航点击
        element.on('nav(demo)', function (elem) {
            //console.log(elem)
//      layer.msg(elem.text());
        });
        //普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            , url: '/upload/'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                //上传成功
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
        var uploadInst2 = upload.render({
            elem: '#test2'
            , url: '/upload/'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo2').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                //上传成功
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
        var uploadInst3 = upload.render({
            elem: '#test3'
            , url: '/upload/'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo3').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                //上传成功
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });

        //监听提交
        form.on('submit(demo1)', function (data) {
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            });
            return false;
        });


    });

</script>
<script type="text/javascript">
    var clock = '';
    var nums = 60;
    var btn;
    var code = '';
    var telcode = '';
    //修改姓名
    $("#name_save .bind").click(function () {
        var name = $("#name_input").val();
        var id = $(this).attr('id');
        // console.log(id);
        // console.log(name);
        if(!name){
            layer.msg('请输入姓名');
            return false;
        }
        var reg=/^[\u4e00-\u9fa5]+$/;
        if(!reg.test(name)){
            layer.msg('请输入中文');
            return false;
        }
        if ( $.trim(name).length < 2 || $.trim(name).length > 20) {
            layer.msg('必须为2-20个字符');
            return false;
        }
        $.ajax({
            type: "post",
            url: "member/admin_edit",
            data: {'name': name, 'id': id},
            dataType: "json",
            success: function (data) {
                // console.log(data);
                if (data.code == 0) {
                    setTimeout(function () {
                        window.location.reload();
                    }, 2000);
                    // layer.msg(data.msg)
                } else {
                    layer.msg(data.msg)
                }
            }
        })
    });
    //修改所属公司
    $("#company_save .bind").click(function () {
        var company = $("#company_input").val();
        var id = $(this).attr('id');
        if (!company) {
            layer.msg('请填写工商局注册的全称');
            return false;
        }
            var reg=/^[A-Za-z0-9\_\-\(\)（）\u4e00-\u9fa5]+$/;//中文，英文和数字
            if(!reg.test(company)){
                layer.msg('请输入中文，英文，数字,"-","_","（）","()"的组合');
                return false;
            }
            if ( $.trim(company).length < 4 || $.trim(company).length > 40) {
                layer.msg('请输入4-40个字符');
                return false;
            }
        $.ajax({
            type: "post",
            url: "member/admin_edit",
            data: {'company': company, 'id': id},
            dataType: "json",
            success: function (data) {
                // console.log(data);
                if (data.code == 0) {
                    setTimeout(function () {
                        window.location.reload();
                    }, 2000);
                    // layer.msg(data.msg)
                } else {
                    layer.msg(data.msg)
                }
            }
        })
    });

    //邮箱发送验证码
    $("#email_save .bind").click(function () {
        $('.mask').removeClass('none');
        $('#layui-layer2').css('display', 'block');
        $('#layui-layer1').css('display', 'none');
        var email = $("#email_input").val();
        var id = $(this).attr('id');
        $('#layui-layer2 .six').text(email);
    });

    //邮箱发送验证码
    $("#email_save_new .bind").click(function () {
        $('.mask').removeClass('none');
        $('#layui-layer2').css('display', 'none');
        $('#layui-layer1').css('display', 'none');
        $('#layui-layer3').css('display', 'block');
        var email = $("#email_input").val();
        var id = $(this).attr('id');
        $('#layui-layer2 .six').text(email);
    });

    function sendEma(thisBtn, type) {
        if (type == 1) {
            var email = $("#email_input").attr('data');
        } else if (type == 2) {
            var email = $("#mailtwo").val();
            if (!email) {
                layer.msg('请先填写新E-mail地址');
                return false;
            }
            var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
            if (!reg.test(email)) {
                layer.msg('E-mail地址不规范，请重新填写');
                return false;
            }
        } else {
            var email = $("#mailtwo_new").val();
            if (!email) {
                layer.msg('请先填写新E-mail地址');
                return false;
            }
            var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
            if (!reg.test(email)) {
                layer.msg('E-mail地址不规范，请重新填写');
                return false;
            }
        }
        $("#sendEmail").attr('disabled', 'disabled');
        $.ajax({
            type: "POST",
            url: "member/admin_edit_email",
            data: {email: email},
            dataType: "json",
            success: function (data) {
                $("#sendEmail").removeAttr("disabled");
                console.log(data);
                if (data.code == 0) {
                    btn = thisBtn;
                    btn.disabled = true; //将按钮置为不可点击
                    btn.value = nums + '秒后可重新获取';
                    clock = setInterval(doLoop, 1000); //一秒执行一次
                    code = data.data.code;
                    layer.msg(data.msg);
                } else {
                    layer.alert(data.msg);
                }
            }
        });
    }

    $('#emailCheck_new').click(function () {
        var ele = $(this);

        var new_email = $('#mailtwo_new').val();
        if (!new_email) {
            layer.msg('请先填写新E-mail地址');
            return false;
        }
        var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
        if (!reg.test(new_email)) {
            layer.msg('E-mail地址不规范，请重新填写');
            return false;
        }

        var code = $('#emailCode_new').val();
        if (!code) {
            layer.msg('先填写验证码');
            return false;
        }
        $.getJSON("member/check_email_code?key=" + new_email + "&code=" + code, function (data) {
            if (data.code == 0) {
                $.ajax({
                    type: "POST",
                    url: "member/admin_edit",
                    data: {newemail: new_email},
                    dataType: "json",
                    success: function (data) {
                        if (data.code == 0) {
                            $('#layui-layer3').css('display', 'none');
                            $('.mask').addClass('none');
                            setTimeout(function () {
                                window.location.reload();
                            }, 2000);
                            layer.msg(data.msg);
                        } else {
                            $('#layui-layer3').css('display', 'none');
                            $('.mask').addClass('none');
                            layer.alert(data.msg);
                        }
                    }
                });
                return true;
            } else {
                layer.msg('验证码填写错误');
                return false;
            }
        });

    });

    $('#emailCheck').click(function () {
        var ele = $(this);
        if ($(this).attr('data') == 1) {
            var cod = $('#emailCode').val();
            var old_email = $('#email_input').val();
            if (!cod) {
                layer.msg('先填写验证码');
                return false;
            }
            $.getJSON("member/check_email_code?key=" + old_email + "&code=" + cod, function (data) {
                if (data.code == 0) {
                    ele.attr('data', 2);
                    $('.vvvv').css('display', 'none');
                    $('.wwwww').css('display', 'block');
                    layer.msg('验证成功');
                    return true;
                } else {
                    layer.msg('验证码填写错误');
                    return false;
                }
            });
        } else {
            var new_email = $('#mailtwo').val();
            if (!new_email) {
                layer.msg('请先填写新E-mail地址');
                return false;
            }
            var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
            if (!reg.test(new_email)) {
                layer.msg('E-mail地址不规范，请重新填写');
                return false;
            }
            var code = $('#emailCode1').val();
            if (!code) {
                layer.msg('先填写验证码');
                return false;
            }
            $.getJSON("member/check_email_code?key=" + new_email + "&code=" + code, function (data) {
                if (data.code == 0) {
                    $.ajax({
                        type: "POST",
                        url: "member/admin_edit",
                        data: {newemail: new_email},
                        dataType: "json",
                        success: function (data) {
                            if (data.code == 0) {
                                $('#layui-layer2').css('display', 'none');
                                $('.mask').addClass('none');
                                setTimeout(function () {
                                    window.location.reload();
                                }, 2000);
                                layer.msg(data.msg);
                            } else {
                                $('#layui-layer2').css('display', 'none');
                                $('.mask').addClass('none');
                                layer.alert(data.msg);
                            }
                        }
                    });
                    return true;
                } else {
                    layer.msg('验证码填写错误');
                    return false;
                }
            });

        }

    });
    //手机发送验证码
    $("#tel_save .bind").click(function () {
        $('.mask').removeClass('none');
        $('#layui-layer1').css('display', 'block');
        $('#layui-layer2').css('display', 'none');
        var tel = $("#tel_input").val();
        var id = $(this).attr('id');
        // $('#layui-layer1 .six').text(tel);
    });

    //手机发送验证码
    $("#tel_save_new .bind").click(function () {
        $('.mask').removeClass('none');
        $('#layui-layer1').css('display', 'none');
        $('#layui-layer2').css('display', 'none');
        $('#layui-layer3').css('display', 'none');
        $('#layui-layer4').css('display', 'block');
        var tel = $("#tel_input").val();
        var id = $(this).attr('id');
        // $('#layui-layer1 .six').text(tel);
    });


    function sendCode(thisBtn, type) {
        if (type == 1) {
            var tel = $("#tel_input").attr('data');
        } else if (type == 2) {
            var tel = $("#teltwo").val();
            if (!tel) {
                layer.msg('请先填写新手机号');
                return false;
            }
            var phone_reg = /^[1][3,4,5,7,8][0-9]{9}$/;
            if (!phone_reg.test(tel)) {
                layer.msg('手机号不规范，请重新填写');
                return false;
            }
        } else {
            var tel = $("#teltwo_new").val();
            if (!tel) {
                layer.msg('请先填写新手机号');
                return false;
            }
            var phone_reg = /^[1][3,4,5,7,8][0-9]{9}$/;
            if (!phone_reg.test(tel)) {
                layer.msg('手机号不规范，请重新填写');
                return false;
            }
        }
        $.ajax({
            type: "POST",
            url: "member/admin_edit_tel",
            data: {tel: tel},
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    btn = thisBtn;
                    btn.disabled = true; //将按钮置为不可点击
                    btn.value = nums + '秒后可重新获取';
                    clock = setInterval(doLoop, 1000); //一秒执行一次
                    telcode = data.data;
                    console.log(data);
                    layer.msg(data.msg);
                } else {
                    layer.msg('发送失败');
                }
            }
        });
    }

    $('#telCheck').click(function () {
        var ele = $(this);

        if ($(this).attr('data') == 1) {
            var cod = $('#telCode').val();
            var old_tel = $('#tel_input').val();
            if (!cod) {
                layer.msg('先填写验证码');
                return false;
            }
            $.getJSON("member/check_email_code?key=" + old_tel + "&code=" + cod, function (data) {
                if (data.code == 0) {
                    ele.attr('data', 2);
                    $('.vvvv1').css('display', 'none');
                    $('.wwwww1').css('display', 'block');
                    layer.msg('验证成功');
                    return true;
                } else {
                    layer.msg('验证码填写错误');
                    return false;
                }
            });
        } else {
            var new_tel = $('#teltwo').val();
            if (!new_tel) {
                layer.msg('请先填写新手机号');
                return false;
            }
            var phone_reg = /^[1][3,4,5,7,8][0-9]{9}$/;
            if (!phone_reg.test(new_tel)) {
                layer.msg('手机号不规范，请重新填写');
                return false;
            }
            var code = $('#telCode1').val();
            if (!code) {
                layer.msg('先填写验证码');
                return false;
            }
            $.getJSON("member/check_email_code?key=" + new_tel + "&code=" + code, function (data) {
                if (data.code == 0) {
                    $.ajax({
                        type: "POST",
                        url: "member/admin_edit",
                        data: {newtel: new_tel},
                        dataType: "json",
                        success: function (data) {
                            if (data.code == 0) {
                                $('#layui-layer1').css('display', 'none');
                                setTimeout(function () {
                                    window.location.reload();
                                }, 2000);
                                layer.msg(data.msg);
                            } else {
                                $('#layui-layer1').css('display', 'none');
                                layer.alert(data.msg);
                            }
                        }
                    });
                    return true;
                } else {
                    layer.msg('验证码填写错误');
                    return false;
                }
            });
        }
    });


    $('#telCheck_new').click(function () {
        var ele = $(this);

        var new_tel = $('#teltwo_new').val();
        if (!new_tel) {
            layer.msg('请先填写新手机号');
            return false;
        }
        var phone_reg = /^[1][3,4,5,7,8][0-9]{9}$/;
        if (!phone_reg.test(new_tel)) {
            layer.msg('手机号不规范，请重新填写');
            return false;
        }

        var code = $('#telCode_new').val();
        if (!code) {
            layer.msg('先填写验证码');
            return false;
        }
        $.getJSON("member/check_email_code?key=" + new_tel + "&code=" + code, function (data) {
            if (data.code == 0) {
                $.ajax({
                    type: "POST",
                    url: "member/admin_edit",
                    data: {newtel: new_tel},
                    dataType: "json",
                    success: function (data) {
                        if (data.code == 0) {
                            $('#layui-layer4').css('display', 'none');
                            setTimeout(function () {
                                window.location.reload();
                            }, 2000);
                            layer.msg(data.msg);
                        } else {
                            $('#layui-layer4').css('display', 'none');
                            layer.alert(data.msg);
                        }
                    }
                });
                return true;
            } else {
                layer.msg('验证码填写错误');
                return false;
            }
        });

    });


    // function telcheck() {
    //     var cod = $('#telCode').val();
    //     if (telcode == cod) {
    //         $('.vvvv1').css('display', 'none');
    //         $('.wwwww1').css('display', 'block');
    //         var newtel = $('#teltwo').val();
    //         // console.log(cod);
    //         // console.log(telcode);
    //         // console.log(newtel);
    //         $.ajax({
    //             type: "POST",
    //             url: "member/admin_edit",
    //             data: {newtel: newtel},
    //             dataType: "json",
    //             success: function (data) {
    //                 if (data.code == 0) {
    //                     $('#layui-layer1').css('display', 'none');
    //                     setTimeout(function () {
    //                         window.location.reload('member/personal');
    //                     }, 2000);
    //                     layer.msg(data.msg);
    //                 } else {
    //                     $('#layui-layer1').css('display', 'none');
    //                     layer.alert(data.msg);
    //                 }
    //             }
    //         });
    //     } else {
    //         layer.msg('验证码填写错误');
    //     }
    // }

    function doLoop() {
        nums--;
        if (nums > 0) {
            btn.value = nums + '秒后可重新获取';
        } else {
            clearInterval(clock); //清除js定时器
            btn.disabled = false;
            btn.value = '点击发送验证码';
            nums = 10; //重置时间
        }
    }

    function hidePop() {
        $('.mask').addClass('none');
        $('#layui-layer1').css('display', 'none');
        $('#layui-layer2').css('display', 'none');
        $('#layui-layer3').css('display', 'none');
        $('#layui-layer4').css('display', 'none');
    }
</script>
<style type="text/css">
    .layui-layer-title {
        padding: 0px;
    }

    .login_hd {
        cursor: pointer !important;
    }
</style>
</body
</html>
